package com.extension.company.view.my.cerrification;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.extension.company.admin.R;
import com.extension.company.common.mvc.BaseTitleActivity;
import com.extension.company.common.utils.StringUtils;
import com.extension.company.model.api.Urls;
import com.extension.company.view.webview.WebViewActivity;

import butterknife.BindView;

/**
 * 实名认证的首页
 * 输入：姓名、身份证号
 */
public class CertificationActivity extends BaseTitleActivity implements View.OnClickListener {

	@BindView(R.id.tv_pro)
	TextView tv_pro;

	@BindView(R.id.btn_next)
	Button btn_next;

	@BindView(R.id.realname_edt)
	EditText realName;

	@BindView(R.id.idcard_edt)
	EditText idCardEdt;

	public static void startActivity(Activity activity) {
		Intent intent = new Intent(activity, CertificationActivity.class);
		activity.startActivity(intent);
	}

	@Override
	public int getMainLayout() {
		return R.layout.my_certification1;
	}

	@Override
	public void initView() {
		setTitle("实名认证");
		updateSuccessView();
	}

	@Override
	public void initData() {
	}

	@Override
	public void initListener() {
		tv_pro.setOnClickListener(this);
		btn_next.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.tv_pro:
				WebViewActivity.startActivity(this, "个人信息授权书", Urls.CertificationUrl);
				break;
			case R.id.btn_next:
				boolean isTrue = StringUtils.idCardValidate(idCardEdt.getText().toString().trim());
				Log.d("zwk", "身份证验证成功" + isTrue);
				IDPhotoCertificationActivity.startActivity(this);
				break;
			default:
				break;
		}
	}
}
